Working through these tutorials in order is the best way to learn to build GUI's with AWNPipe. A few minutes here will save you hours of development time later.
TUTORIAL 1
-----------
Building GUIs can be VERY easy, This first tutorial will develop a simple GUI.
Create a simple 4 line text file called first.gui. (You can use drag selection and Right-Amiga-C to copy text from these docs.)
title "My first GUI" defaultgadgets
button gadgettext "YES"
button gt "NO"
open
Now, in a shell, type 'copy first.gui awnpipe:/xc'.
That was easy. You already guessed that gt was a short form for gadgettext.
Now we want to see what events the GUI sends. We can direct the events to a con by adding 'wcon:' to the end of the pipe name. Try
'copy first.gui awnpipe:/xcwcon:'
Look at the output in the con:. Notice that the pipe replies to each line of the definition file, as well as sending events.
Now add a little text to the gui. We will also provide keyboard shortcuts for the gadgets.
title "My first GUI" defaultgadgets
label gt " Select YES or NO "
button gadgettext "_YES"
button gadgettext "_NO"
open
That worked, but it looks a little UGLY. Let's try a vertical layout instead of the default horizontal layout.
title "My first GUI" defaultgadgets vertical
label gt " Select YES or NO "
button gadgettext "_YES"
button gadgettext "_NO"
open
The GUI is starting to look better, but we really want the two gadgets side-by-side. To do that, we will use a layout group. ("le" is short for "layout end".)
title "My first GUI" defaultgadgets vertical
label gt " Select YES or NO "
layout
button gadgettext "_YES"
button gadgettext "_NO"
le
open
That is much better! The GUI looks good, but it would be nicer if the window closed after the user selected yes or no. (You should also notice that the layout received a GID number, so yes and no are now gadget 2 and 3.)
title "My first GUI" defaultgadgets vertical
label gt " Select YES or NO "
layout
button gadgettext "_YES" close
button gadgettext "_NO" c
le
open
It's done and it might even be useful.
Since we have a working GUI, let's use it to see a few other types of events the GUI can generate.
title "My first GUI" defaultgadgets vertical sendkeys sendqual help state
label gt " Select YES or NO "
layout
button gadgettext "_YES" close
button gadgettext "_NO" c
le
open
Activate and deactivate the window. Hold the mouse over each gadget. Type a few keys. Try the shift, alt etc.